home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / swingall.jar / javax / swing / plaf / basic / BasicHTML$Renderer.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-07-15  |  2.9 KB  |  114 lines

  1. package javax.swing.plaf.basic;
  2.  
  3. import java.awt.Container;
  4. import java.awt.Graphics;
  5. import java.awt.Rectangle;
  6. import java.awt.Shape;
  7. import javax.swing.JComponent;
  8. import javax.swing.text.AttributeSet;
  9. import javax.swing.text.BadLocationException;
  10. import javax.swing.text.Document;
  11. import javax.swing.text.Element;
  12. import javax.swing.text.Position;
  13. import javax.swing.text.View;
  14. import javax.swing.text.ViewFactory;
  15.  
  16. class BasicHTML$Renderer extends View {
  17.    private int width;
  18.    private View view;
  19.    private ViewFactory factory;
  20.    private JComponent host;
  21.  
  22.    BasicHTML$Renderer(JComponent var1, ViewFactory var2, View var3) {
  23.       super((Element)null);
  24.       this.host = var1;
  25.       this.factory = var2;
  26.       this.view = var3;
  27.       this.view.setParent(this);
  28.       this.setSize(this.view.getPreferredSpan(0), this.view.getPreferredSpan(1));
  29.    }
  30.  
  31.    public float getAlignment(int var1) {
  32.       return this.view.getAlignment(var1);
  33.    }
  34.  
  35.    public AttributeSet getAttributes() {
  36.       return null;
  37.    }
  38.  
  39.    public Container getContainer() {
  40.       return this.host;
  41.    }
  42.  
  43.    public Document getDocument() {
  44.       return this.view.getDocument();
  45.    }
  46.  
  47.    public Element getElement() {
  48.       return this.view.getElement();
  49.    }
  50.  
  51.    public int getEndOffset() {
  52.       return this.view.getEndOffset();
  53.    }
  54.  
  55.    public float getMaximumSpan(int var1) {
  56.       return (float)Integer.MAX_VALUE;
  57.    }
  58.  
  59.    public float getMinimumSpan(int var1) {
  60.       return this.view.getMinimumSpan(var1);
  61.    }
  62.  
  63.    public float getPreferredSpan(int var1) {
  64.       return var1 == 0 ? (float)this.width : this.view.getPreferredSpan(var1);
  65.    }
  66.  
  67.    public int getStartOffset() {
  68.       return this.view.getStartOffset();
  69.    }
  70.  
  71.    public View getView(int var1) {
  72.       return this.view;
  73.    }
  74.  
  75.    public int getViewCount() {
  76.       return 1;
  77.    }
  78.  
  79.    public ViewFactory getViewFactory() {
  80.       return this.factory;
  81.    }
  82.  
  83.    public Shape modelToView(int var1, Shape var2, Position.Bias var3) throws BadLocationException {
  84.       return this.view.modelToView(var1, var2, var3);
  85.    }
  86.  
  87.    public Shape modelToView(int var1, Position.Bias var2, int var3, Position.Bias var4, Shape var5) throws BadLocationException {
  88.       return this.view.modelToView(var1, var2, var3, var4, var5);
  89.    }
  90.  
  91.    public void paint(Graphics var1, Shape var2) {
  92.       Rectangle var3 = var2.getBounds();
  93.       this.view.setSize((float)var3.width, (float)var3.height);
  94.       this.view.paint(var1, var2);
  95.    }
  96.  
  97.    public void preferenceChanged(View var1, boolean var2, boolean var3) {
  98.       this.host.revalidate();
  99.    }
  100.  
  101.    public void setParent(View var1) {
  102.       throw new Error("Can't set parent on root view");
  103.    }
  104.  
  105.    public void setSize(float var1, float var2) {
  106.       this.width = (int)var1;
  107.       this.view.setSize(var1, var2);
  108.    }
  109.  
  110.    public int viewToModel(float var1, float var2, Shape var3, Position.Bias[] var4) {
  111.       return this.view.viewToModel(var1, var2, var3, var4);
  112.    }
  113. }
  114.